
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module MessageSorter
* @author: Hjava
* @description: 消息排序模块
* @since: 2018-07-23 12:45:29
*/
var MessageSorter = /** @class */ (function () {
    function MessageSorter() {
    }
    MessageSorter.prototype.sort = function (messages) {
        if (messages === void 0) { messages = []; }
        if (!messages || messages.length === 0) {
            return [];
        }
        var result = __spreadArrays(messages);
        result.sort(this._msgsMidCompare);
        return result;
    };
    MessageSorter.prototype._msgsMidCompare = function (prev, next) {
        if (prev.svrTime && next.svrTime) {
            return prev.svrTime - next.svrTime;
        }
        else {
            return prev.time - next.time;
        }
    };
    return MessageSorter;
}());
exports.default = new MessageSorter();


//# sourceURL=webpack://MTDX/./src/extra/utils/messageSorter.ts?